package org.springframework;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.po.MyClassPathXmlApplicationContext;
import org.springframework.service.UserService;
import org.springframework.po.User;

public class Main {
	public static void main(String[] args) {
		// 读取spring配置文件
		ApplicationContext context = new MyClassPathXmlApplicationContext("classpath:spring-test.xml","classpath:spring-test1.xml");

		// 获取service的bean对象
		UserService userService = (UserService) context.getBean("userService");

		// 执行service方法查询user对象
		User user = userService.getUserById(1);

		// 输出user结果
		System.out.println(user);
	}
}